﻿using parkMonitor.language;
using parkMonitor.model;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace parkMonitor.viewModel.alarm
{
    /// <summary>报警项ViewModel</summary>
    public class AlarmItemVM : INotifyPropertyChanged
    {
        public AlarmItemVM()
        {

        }

        //设备类型
        DeviceType _DevType = DeviceType.Central;
        public DeviceType DevType
        {
            get { return _DevType; }
            set { _DevType = value; FirePropertyChanged("DevType"); }
        }

        //设备Id
        string _DeviceId = "";
        public string DeviceId
        {
            get { return _DeviceId; }
            set { _DeviceId = value; FirePropertyChanged("DeviceId"); }
        }

        //设备名
        string _DeviceName = "";
        public string DeviceName
        {
            get { return _DeviceName; }
            set { _DeviceName = value; FirePropertyChanged("DeviceName"); }
        }

        //信息
        string _Info = "";
        public string Info
        {
            get { return _Info; }
            set { _Info = value; FirePropertyChanged("Info"); }
        }

        //报警状态
        AlarmStatus _Status = AlarmStatus.Info;
        public AlarmStatus Status
        {
            get { return _Status; }
            set
            {
                _Status = value;
                switch (value)
                {
                    case AlarmStatus.Info: StrStatus = Language.ins.info; break;
                    case AlarmStatus.Warning: StrStatus = Language.ins.warning; break;
                    case AlarmStatus.Error: StrStatus = Language.ins.error; break;
                    default: StrStatus = ""; break;
                }
                FirePropertyChanged("Status");
            }
        }

        //报警状态
        string _StrStatus = "";
        public string StrStatus
        {
            get { return _StrStatus; }
            set { _StrStatus = value; FirePropertyChanged("_StrStatus"); }
        }

        public virtual event PropertyChangedEventHandler PropertyChanged;
        public virtual void FirePropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged.Invoke(this, new PropertyChangedEventArgs(propertyName));
            }
        }
    }
}
